//
//  User.m
//  王雷Sinoweibo
//
//  Created by wanglei on 16/11/19.
//  Copyright © 2016年 wanglei. All rights reserved.
//

#import "User.h"

@implementation User

+ (instancetype)UserWithDict:(NSDictionary *)dict;{
    
    return [[self alloc]initWithUserDict:dict];
}
//懒加载

-(NSURL *)profile_url{
    return [NSURL URLWithString:_profile_image_url];
}

- (UIImage *)verified_type_image{
    switch (_verified_type) {
            case 0:
            return [UIImage imageNamed:@"avatar_vip"];
            break;
            case 2:
            case 3:
            case 5:
            return [UIImage imageNamed:@"avatar_enterprise_vip"];
            break;
            case 220:
            return [UIImage imageNamed:@"avatar_grassroot"];
            break;
        default:
            return nil;
            break;    
    }
    
}

-(int)mbrank{
    
    if (_mbrank == NULL) {
        
        return 0;
    }
    
    return _mbrank;
}
-(UIImage *)mbrank_image{
    
    if (_mbrank >7 && _mbrank <0) {
        
        return [UIImage imageNamed:@"common_icon_membership_level\(_mbrank)"];
    }
    
    return [UIImage imageNamed:@"common_icon_membership"];
}


- (instancetype)initWithUserDict:(NSDictionary *)dict;{
    
    self = [super init];
    
    if(self){
        
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}


-(void)setValue:(id)value forUndefinedKey:(NSString *)key;{}
@end
